package site.yunnong.atvris.portal.spider;

import com.geccocrawler.gecco.pipeline.PipelineFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import javax.annotation.Resource;

/**
 * @author zjh
 * @date 2021/8/30 0:07
 */
public abstract class SpringGeccoEngine implements ApplicationListener<ContextRefreshedEvent> {

    @Resource
    private PipelineFactory springPipelineFactory;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        if (event.getApplicationContext().getParent() == null) {
            init();
        }
    }
    
    public abstract void init();
}
